<?php
include '../variables/varConector.php';


if ($_REQUEST["opc"] == '') {

       include '../funciones/funciones.php';
       echo "<div style=\"padding-left: 80px; padding-right: 80px; padding-top: 150px;\" align=\"center\">";
       cadenaFondoAzul("Insertar C&eacute;dula");
       echo "</div>";
?>
       <div style="padding-left: 100px; padding-right: 100px; padding-top: 5px;" align="center">
              <div style="width: 300px;">

              <form action="?p=socio/buscarSocio&opc=busco" method="POST">
                     <table>
                            <tr>
                                   <td align="left" style="width: 100px;">C&eacute;dula</td>
                                   <td>
                                          <input name="cedula" id="cedula" type="text" style="width: 150px;">
                                   </td>
                            </tr>
                            <tr>
                                   <td colspan="2" align="center">
                                          <input type="submit" value="Buscar">
                                   </td>
                            </tr>
                     </table>
                  <input type="hidden" name="matriz" value="<?php $Matriz; ?>">
              </form>


       </div>
</div>

<?php
              } else
              if ($_REQUEST["opc"] == 'busco') {

                     include '../funciones/funciones.php';

                     foreach ($_REQUEST AS $clave => $valor) {
                            $$clave = $valor;
                     }

                     $conector = mysql_connect(HOST, USUARIO, PASSWORD);
                     mysql_select_db(BD, $conector);
                     $sql = "SELECT * FROM socio WHERE cedula = '$cedula' AND activo = 1";
                     $resultado = mysql_query($sql, $conector);
                     mysql_close($conector);

                     if (mysql_num_rows($resultado) == '1') {
                            $linea = mysql_fetch_row($resultado);


                            echo "<div align=\"center\"><div style=\"padding-left: 100px; padding-right: 100px; padding-top: 25px;\" align=\"center\">";
                            cadenaFondoAzul("Datos del Socio");
                            echo "</div></div>";
?>

       <div style="padding-left: 100px; padding-right: 100px; padding-top: 5px;" align="center">
              <div style="width: 300px;">
              <table>
                     <tr>
                            <td align="left" style="width: 100px;">Nombre</td>
                            <td>
                                   <input type="text" value="<?php echo $linea["2"]; ?>" style="width: 150px;" disabled="true">
                            </td>
                     </tr>
                     <tr>
                            <td align="left" style="width: 100px;">C&eacute;dula</td>
                            <td>
                                   <input type="text" value="<?php echo $linea["1"]; ?>" style="width: 150px;" disabled="true">
                            </td>
                     </tr>
                     <tr>
                            <td align="left" style="width: 100px;">Tel&eacute;fono</td>
                            <td>
                                   <input type="text" value="<?php echo $linea["3"]; ?>" style="width: 150px;" disabled="true">
                            </td>
                     </tr>
                     <tr>
                            <td align="left" style="width: 100px;">Status</td>
                            <td><select style="width: 150px;" disabled="true">
                                   <option value="0" <?php if ($linea["4"] == '0') { echo "selected"; } ?>>Ordinario</option>
                                   <option value="1" <?php  if ($linea["4"] == '1') {  echo "selected";  } ?>>Directivo</option>
                                </select>
                            </td>
                     </tr>
              </table>
       </div>
</div>

<?php
       $conector = mysql_connect(HOST, USUARIO, PASSWORD);
       mysql_select_db(BD, $conector);
       $sql = "SELECT placa FROM camion, socio WHERE socio.id = idSocioRef AND cedula = '$cedula' AND socio.activo = 1 AND camion.activo = 1";
       $resultado = mysql_query($sql, $conector);
       mysql_close($conector);

       $cantCam = @mysql_num_rows($resultado);

       echo "<div style=\"padding-left: 100px; padding-right: 100px; padding-top: 10px;\" align=\"center\">";
       cadenaFondoAzul("Camiones del Socio");
       echo "</div>";
?>

 <div style="padding-left: 100px; padding-right: 100px; padding-top: 5px;" align="center">
              <div style="width: 300px;">
       <table>
              <tr align="center">
                     <td style="width: 255px;">Placa</td>
              </tr>
<?php
       for($i = 1 ; $i <= $cantCam ; $i++){
              $linea = @mysql_fetch_row($resultado);
              if( $i%2 == 0){
?>
                     <tr class="zebraPar"  align="center">
                            <td><?php echo $linea["0"]; ?></td>
                     </tr>
<?php
              }else{
?>
                     <tr class="zebraImpar" align="center">
                            <td><?php echo $linea["0"]; ?></td>
                     </tr>
<?php
              }
       }
} else {
       echo "<div style=\"padding-left: 100px; padding-right: 100px; padding-top: 150px;\" align=\"center\">";
       cadenaFondoAzul("No se encontro algun Socio con esa C&eacute;dula");
       echo "</div>";
}
}
?>
      </table></div></div>